package com.yunxin.core.application.service.impl;

import com.yunxin.core.application.dto.user.UserInfoDTO;
import com.yunxin.core.application.service.UserQueryGatewayService;
import com.yunxin.core.infra.common.user.UserAuthTypeEnum;
import com.yunxin.core.infra.persistence.entity.user.UserInfoDO;
import com.yunxin.core.infra.persistence.mapper.user.UserInfoExtendMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author zero°
 * @since 2023-07-19
 */
@Service
@RequiredArgsConstructor
public class UserQueryGatewayServiceImpl implements UserQueryGatewayService {

    private final UserInfoExtendMapper userInfoExtendMapper;


    @Override
    public UserInfoDTO getUserInfo(String userCode) {
        UserInfoDO userInfoDO = userInfoExtendMapper.selectUserInfoByUserCode(userCode);
        UserInfoDTO userInfoDTO = new UserInfoDTO();
        userInfoDTO.setAuthStatus(UserAuthTypeEnum.AUTH.getValue());
        userInfoDTO.setAuthStatusStr(UserAuthTypeEnum.AUTH.getLabel());
        userInfoDTO.setPhone(userInfoDO.getPhone());
        userInfoDTO.setUserCode(userCode);
        return userInfoDTO;
    }

}
